<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="../include/tag.jsp" %>
<!DOCTYPE html>
<html lang="zh">
<head>
    <title>商品主题分类</title>
    <link rel="stylesheet" href="${ctx}/css/common/list.css">
    <link rel="stylesheet" href="${ctx}/css/common/table.css">
    <%@include file="../include/commonFile.jsp" %>
</head><body>
<!--头部-->
<%@include file="../include/header.jsp" %>
<div class="index-outside">
    <%@include file="../include/sidebar.jsp" %>
    <!--内容-->
    <section>
        <div class="section-main">
            <form class="layui-form" action="${ctx}/mall/showtemplate/list.do" id="myForm" method="post">
                <input type="hidden" name="pageNo" id="pageNo"/>
                <div class="f-search-bar">
                    <div class="search-container">
                        <ul class="search-form-content">
                            <li class="form-item-inline"><label class="search-form-lable">分类名称</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="name" autocomplete="off" class="layui-input"
                                           value="${mallShowSubjectTemplateQuery.name}" placeholder="分类名称">
                                </div>
                            </li>
                            <li class="form-item-inline">
                                <div class="sub-btns">
                                    <a class="layui-btn layui-btn-danger"
                                       href="javascript:submitFunction('#myForm')">查询</a>
                                    <a class="layui-btn layui-btn-normal"
                                       href="javascript:resetFunction('#myForm')">重置</a>
                                </div>
                            </li>
                        </ul>
                        <ul class="search-form-content">
                            <li class="form-item"><label class="search-form-lable">发布时间</label>
                                <div class="check-btn-inner" id="timeType">
                                    <a id="all" href="javascript:void(0);"
                                       onclick="setTimeType($(this),0,'#myForm')" ${empty mallShowSubjectTemplateQuery.timeType || mallShowSubjectTemplateQuery.timeType == 0 ? 'class="active"' : ''}>全部</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),1,'#myForm')" ${mallShowSubjectTemplateQuery.timeType == 1 ? 'class="active"' : ''}>今天</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),2,'#myForm')" ${mallShowSubjectTemplateQuery.timeType == 2 ? 'class="active"' : ''}>本周内</a>
                                    <a href="javascript:void(0);"
                                       onclick="setTimeType($(this),3,'#myForm')" ${mallShowSubjectTemplateQuery.timeType == 3 ? 'class="active"' : ''}>本月内</a>
                                    <input type="hidden" name="timeType" value="${mallShowSubjectTemplateQuery.timeType}"/>
                                </div>
                                <div class="layui-inline">
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createStart"
                                               value="${mallShowSubjectTemplateQuery.createStart}" placeholder="开始日"
                                        >
                                    </div>
                                    -
                                    <div class="layui-input-inline">
                                        <input class="layui-input" type="text" name="createEnd"
                                               value="${mallShowSubjectTemplateQuery.createEnd}" placeholder="截止日"
                                        >
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                </div>
            </form>
            <div class="list-content">
                <div class="cl">
                    <table class="layui-table">
                        <colgroup>
                            <col width="5%">
                            <col width="10%">
                            <col width="5%">
                            <col width="10%">
                            <col width="10%">
                            <col width="15%">
                        </colgroup>
                        <thead>
                        <tr>
                            <th>序号</th>
                            <th>主题分类</th>
                            <th>商品数</th>
                            <th>发布时间</th>
                            <th>关联机构数</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach var="template" items="${templates}" varStatus="status">

                            <tr class="detail-content">
                                <td>
                                    <c:choose>
                                        <c:when test="${status.index < 9}">
                                            0${status.index + 1}
                                        </c:when>
                                        <c:otherwise>
                                            ${status.index + 1}
                                        </c:otherwise>
                                    </c:choose>
                                </td>

                                <td class="">
                                    <div class="dib ellipsis-1" title="${template.name}">${template.name}</div>
                                </td>

                                <td>
                                    <c:choose>
                                        <c:when test="${empty template.goodsNum}">
                                            0
                                        </c:when>
                                        <c:otherwise>
                                            ${template.goodsNum}
                                        </c:otherwise>
                                    </c:choose>
                                </td>

                                <td>
                                    <fmt:formatDate value="${template.createDate}" pattern="yyyy-MM-dd HH:mm"/>
                                </td>

                                <td>
                                    <c:choose>
                                        <c:when test="${empty template.orgNum}">
                                            0
                                        </c:when>
                                        <c:otherwise>
                                            ${template.orgNum}
                                        </c:otherwise>
                                    </c:choose>
                                </td>

                                <td class="tb-opts">
                                    <div class="comm-opts">
                                        <a class="qr-btn" href="javascript:txz.openQrDialog({
											title:'扫码二维码可预览分享',
											detailList:[{
												title:'专题二维码',
												url:'${template.qrCode}'
											}]
										})">二维码</a>
                                        <a href="${ctx}/mall/showtemplatecategory/list.do?templateId=${template.id}"
                                           target="_self">类型管理</a>
                                        <a href="${ctx}/mall/showtemplate/templateForm.do?id=${template.id}"
                                           target="_self">
                                            编辑
                                        </a>
                                        <a href="javascript:txz.deleteObject('确定要删除该主题？','${ctx}/mall/showtemplate/delete.do?id=${template.id}', '该主题分类下已有商品类型, 不能删除')">
                                            删除
                                        </a>
                                        <a href="javascript:copyObj('确定要复制该主题？','${ctx}/mall/showtemplate/copy.do?id=${template.id}')">
                                            复制
                                        </a>
                                    </div>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
            <div id="page_content" class="page-container"></div>
        </div><!--底部-->
        <%@include file="../include/footer.jsp" %>
    </section>
</div>



<script type="text/javascript" src="${ctx}/script/common/list.js"></script>
<script type="text/javascript" src="${ctx}/script/common/table_option.js"></script>
<script type="text/javascript">
    $(function () {
        //加载分页
        loadPageNew({elem: 'page_content', totalCount: '${page.totalCount}', limit: '${page.limit}', page: '${page.page}'});
        layui.use(['laydate'], function () {
            var laydate = layui.laydate;
            // 查询发布日期
            var start = {
                elem: 'input[name=createStart]'
            };

            var end = {
                elem: 'input[name=createEnd]'
            };
            laydate.render(start);
            laydate.render(end);
        });
    })

</script>
<script type="text/javascript">
    txz.initHeader({
        nav:[{
            name: '商品主题分类',
            curr: true
        }],
        info:'<span class="f12">共<b id="totalCount">${page.totalCount}</b>条记录</span>',
        btns:[{
            name: '新增主题分类',
            icon: 'add',
            href: '${ctx}/mall/showtemplate/templateForm.do'
        }]
    });
</script>
</body>
</html>